/*
 * @Author: 谢子健 1075010289@qq.com
 * @Date: 2024-11-01 19:34:02
 * @LastEditors: 谢子健 1075010289@qq.com
 * @LastEditTime: 2024-11-01 20:13:00
 * @FilePath: \ilink-vue-frontend\src\stores\usePracticeStore.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// /stores/usePracticeStore.ts
import { defineStore } from 'pinia';

interface PracticeItem {
  customPrimary: string;
  practiceName: string;
  practiceIntroduction: string;
  practiceImage: string;
  practiceTag: string;
  practiceUrl: string;
  // 根据实际需要，您可以添加更多字段
}

interface PracticeState {
  practices: PracticeItem[];
  total: number;
  currentPage: number;
}

export const usePracticeStore = defineStore('practice', {
  state: (): PracticeState => ({
    practices: [],
    total: 0,
    currentPage: 1,
  }),
  actions: {
    setPractices(practices: PracticeItem[], total: number, currentPage: number) {
      this.practices = practices;
      this.total = total;
      this.currentPage = currentPage;
    },
    clearPractices() {
      this.practices = [];
      this.total = 0;
      this.currentPage = 1;
    },
  },
});
